package com.kadron.base;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.MappedSuperclass;
import javax.persistence.Transient;

import org.hibernate.validator.NotNull;

import com.kadron.common.KUtil;
import com.kadron.enumeration.KLang;

@MappedSuperclass
public abstract class KTSBase extends KTBase implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -4200192117978720302L;
	
	protected String short_en="";
	protected String short_sr="";
	protected String short_es="";

	public KTSBase() {
		super();
	}
	
	@NotNull
	@Column(name="short_en", nullable = false)
	public String getShort_en() {
		return short_en;
	}

	public void setShort_en(String short_en) {
		this.short_en = short_en;
	}

	@Column(name="short_sr")
	public String getShort_sr() {
		return short_sr;
	}

	public void setShort_sr(String short_sr) {
		this.short_sr = short_sr;
	}

	@Column(name="short_es")
	public String getShort_es() {
		return short_es;
	}

	public void setShort_es(String short_es) {
		this.short_es = short_es;
	}
	
	@Transient
	public String getShort(String lang) {
		String value = "";
		if (KUtil.isEmpty(lang) || lang.equalsIgnoreCase(KLang.EN.name())) {
			value = getShort_en();
		} else if (lang.equalsIgnoreCase(KLang.ES.name())) {
			value = getShort_es();
		} else {
			value = getShort_sr();
		}
		if (KUtil.isEmpty(value)) {
			value = getShort_en();
		}
		return value;
	}

}
